1. Field of the Invention
The present invention relates to a system for decoding a variable-length codeword and a method for the same.
2. Description of the Related Art
In data transmission, a variable-length codeword having a prefix portion and a suffix portion is used. The code length of the suffix portion is determined by the number of bits of the prefix portion. For example, with regard to an exp-golomb codeword, the decoding result is determined by the number of zeros in the prefix portion and the codeword of the suffix portion.
In the related art, a variable-length codeword is decoded by use of a general-purpose processor having a zero detection command. The processor executes the following steps:
(1) The number of zeros located in a line from the top of the variable-length codeword stored in a buffer circuit is counted by the zero detection command.
(2) The location of the first bit of the suffix portion of the variable-length codeword stored in the buffer circuit is calculated on the basis of the number of zeros.
(3) The suffix portion is stored in the buffer circuit.
(4) The decoding result is obtained from the number of zeros in the prefix portion and the codeword of the suffix portion.
Each of the steps listed above requires an execution time corresponding to at least one cycle of the processor. Moreover, also in the case of a short codeword within the capacity of the buffer circuit, the codeword is decoded using the above steps. Accordingly, in the case of the short codeword, a period of approximately 5 to 10 cycles is required to decode the exp-golomb codeword.
There is a method for decoding a variable-length codeword in which the codeword is divided into halves having a half-length of the maximum code length when the number of bits of the variable-length codeword is larger than the number of bits which can be stored in the buffer circuit. However, in this method, a buffer circuit which can store the codeword having a half-length of the maximum code length is required.